<?php
	header("Content-type:text/html;charset=utf-8");

	require 'user/UserModel.php';
	require 'basis/Controller.php';

	class UserController extends Controller{

		function __construct(){
			parent::__construct();
		}

		function listusers(){
		// 	$data=array(
		// array('username'=>'jason','gender'=>'男'),
		// array('username'=>'jack','gender'=>'男'),
		// array('username'=>'rose','gender'=>'女')
		// 	);
			$model=new UserModel();
			$data=$model->getUserlist();
			//include 'user/listuser.php';
			$this->assgin('users',$data);
			$this->display();
		}

		function userform(){
			//include 'user/userform.php';
			$this->display();
		}
		
		function adduser(){
			
			$data=$_POST;var_dump($data);
			$model=new UserModel();
			$result=$model->adduser($data);
		}
		
		function useredit(){
			$id = $_GET['id'];
			var_dump($id);
			$model=new UserModel();
			$data=$model->useredit($id); 
   		// 	$uname = $row['uname'];
   		// 	$password = $row['password'];
   		// 	$gender = $row['gender'];
  			//  $birthdate = $row['birthdate'];
  			//  $hobby = $row['hobby'];
  			//  $degree = $row['degree'];
  			// $intro = $row['intro'];
  			// $pic = UserPhotoPath.$row['pic'];
 			$this->assgin('user',$data);
 			$this->display();
			//include 'user/useredit.php';
		}
		

		function updateuser(){
			$data=$_POST;
			$model=new UserModel();
			$result=$model->updateuser($data);
		}

		function deleteuser(){
			$id = $_GET['id'];
			$model=new UserModel();
			$result=$model->deleteuser($id);			
		}
	}
?>